package gold.digger;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC835 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int largestOverlap(int[][] A, int[][] B) {
            int N = A.length;
            int[][] count = new int[2 * N + 1][2 * N + 1];
            for (int i = 0; i < N; ++i)
                for (int j = 0; j < N; ++j)
                    if (A[i][j] == 1)
                        for (int i2 = 0; i2 < N; ++i2)
                            for (int j2 = 0; j2 < N; ++j2)
                                if (B[i2][j2] == 1)
                                    count[i - i2 + N][j - j2 + N] += 1;

            int ans = 0;
            for (int[] row : count)
                for (int v : row)
                    ans = Math.max(ans, v);
            return ans;
        }
    }

    public void run() {
        Solution solution = new Solution();
        List<Integer> list = new ArrayList<>();
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC835 an = new LC835();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
